#ifndef _HARDWARE_H_
#define	_HARDWARE_H_

#include "Global.h"

#define SEL_PA3_OPA1N()  do{_pa3s1 = 0; _pa3s0 = 0;}while(0)    
#define SEL_PA3_GPIO()   do{_pa3s1 = 1; _pa3s0 = 0;}while(0)
#define SEL_PA3_AN3()    do{_pa3s1 = 1; _pa3s0 = 0;}while(0)

#define SEL_PA2_GPIO()   do{_pa2s1 = 0; _pa2s0 = 0;}while(0)
#define SEL_PA2_ADCREF() do{_pa2s1 = 0; _pa2s0 = 1;}while(0)
#define SEL_PA2_PTP1B()  do{_pa2s1 = 1; _pa2s0 = 0;}while(0)
#define SEL_PA2_AN2()    do{_pa2s1 = 1; _pa2s0 = 1;}while(0)

#define SEL_PA1_OPA1O()  do{_pa1s1 = 0; _pa1s0 = 0;}while(0)
#define SEL_PA1_GPIO()   do{_pa1s1 = 1; _pa1s0 = 0;}while(0)
#define SEL_PA1_AN1()    do{_pa1s1 = 1; _pa1s0 = 1;}while(0)

#define SEL_PA0_GPIO()   do{_pa0s1 = 0; _pa0s0 = 0;}while(0)
#define SEL_PA0_OCPREF() do{_pa0s1 = 0; _pa0s0 = 1;}while(0)
#define SEL_PA0_PTP1()   do{_pa0s1 = 1; _pa0s0 = 0;}while(0)
#define SEL_PA0_AN0()    do{_pa0s1 = 1; _pa0s0 = 1;}while(0)

#define SEL_PA7_OPA0O()  do{_pa7s1 = 0; _pa7s0 = 0;}while(0)
#define SEL_PA7_GPIO()   do{_pa7s1 = 1; _pa7s0 = 0;}while(0)
#define SEL_PA7_AN7()    do{_pa7s1 = 1; _pa7s0 = 1;}while(0)

#define SEL_PA6_OPA0N()  do{_pa6s1 = 0; _pa6s0 = 0;}while(0)
#define SEL_PA6_GPIO()   do{_pa6s1 = 1; _pa6s0 = 0;}while(0)
#define SEL_PA6_AN6()    do{_pa6s1 = 1; _pa6s0 = 1;}while(0)

#define SEL_PA5_OPA0P()  do{_pa5s1 = 0; _pa5s0 = 0;}while(0)
#define SEL_PA5_GPIO()   do{_pa5s1 = 1; _pa5s0 = 0;}while(0)
#define SEL_PA5_AN5()    do{_pa5s1 = 1; _pa5s0 = 1;}while(0)

#define SEL_PA4_OPA1P()  do{_pa4s1 = 0; _pa4s0 = 0;}while(0)
#define SEL_PA4_GPIO()   do{_pa4s1 = 0; _pa4s0 = 1;}while(0)
#define SEL_PA4_CTP()    do{_pa4s1 = 1; _pa4s0 = 0;}while(0)
#define SEL_PA4_AN4()    do{_pa4s1 = 1; _pa4s0 = 1;}while(0)

#define SEL_PB2_GPIO()   do{_pb2s1 = 0; _pb2s0 = 0;}while(0)
#define SEL_PB1_GPIO()   do{_pb1s1 = 0; _pb1s0 = 0;}while(0)
#define SEL_PB0_GPIO()   do{_pb0s1 = 0; _pb0s0 = 0;}while(0)

#define SEL_PB7_GPIO()   do{_pb7s1 = 0; _pb7s0 = 0;}while(0)
#define SEL_PB7_PTP0B()  do{_pb7s1 = 1; _pb7s0 = 0;}while(0)
#define SEL_PB7_OCPI()   do{_pb7s1 = 1; _pb7s0 = 1;}while(0)

#define SEL_PB6_GPIO()   do{_pb6s1 = 0; _pb6s0 = 0;}while(0)
#define SEL_PB6_PTP0()   do{_pb6s1 = 1; _pb6s0 = 0;}while(0)

#define SEL_PB5_GPIO()   do{_pb5s1 = 0; _pb5s0 = 0;}while(0)
#define SEL_PB5_PTP2()   do{_pb5s1 = 1; _pb5s0 = 0;}while(0)

#define SEL_PB4_GPIO()   do{_pb4s1 = 0; _pb4s0 = 0;}while(0)

#define SEL_PD0_GPIO()   do{_pd0s1 = 0; _pd0s0 = 0;}while(0)
#define SEL_PD0_PTP2B()  do{_pd0s1 = 1; _pd0s0 = 0;}while(0)


#define C_TM_WDTC_128MS  0b01010010  
#define C_TM_WDTC_512MS  0b01010011
#define C_TM_WDTC_1S     0b01010100

void SystemClockConfigure();
void Clear_RamInit();
void IO_Init();

#endif
